#include "io.h"

/*
 *@brief:
 *
 */
int registerIoEvent( struct ioCtx  **ioctx, int type){
	struct ioCtx *tmp = *ioctx;
	if(!tmp){
		tmp = (struct ioCtx *)malloc(sizeof(struct ioCtx));
	}
	switch(type){
		case EPOLL_MODULE:
			tmp->ioInit = epollIoInit;
			tmp->ModEvent = epollModEvent;
			tmp->delEvent = epollDelEvent;
			tmp->ioWaitEvent = epollWaitEvent;
			tmp->deInit = epollIoDeinit;
			break;
		default:
			fprintf(stderr, "[error]%s in file:[%s] func:[%s] line:[%d]\n", strerror(errno), __FILE__, __func__, __LINE__);
			return RET_ERROR;
	}
	*ioctx = tmp;
	return RET_OK;
}
